
<div class='fui-page fui-page-current'>
    <div class="fui-header">
		<div class="fui-header-left">
			<a class="back" ng-click="goback()"></a>
		</div>
		<div class="title">购物卡中心</div> 
		<div class="fui-header-right">&nbsp;</div>
    </div>
    <div class="fui-content navbar">
		<div class="fui-cell-group fui-cell-click mod-group" style="margin-top:0">
				<a class="fui-cell external" href="javascript:;">
								<div class="fui-cell-icon"><i class="icon icon-chongzhi"></i></div>
								<div class="fui-cell-text">充值兑换</div>
				</a>
				<div class="fui-icon-group col-3 selecter" style="padding:0 0.5rem">
					<a ng-repeat="item in pagedata.list" class="fui-icon-col external" href="javascript:;" ng-click="pagedata.buy(item.id)">
						<div style="padding:0.2rem;margin:0 0.2rem;border:1px solid #18bc9c;border-radius:0.2rem">
							<div ng-show="item.hot==1" class="badge" style="top:-4px;left:77%">hot</div>
							<div class="text bold" style="padding-bottom:0;font-size:0.8rem">{{item.money}}元</div>
							<div class="subtitle">售价{{item.price}}元</div>
						</div>
					</a>
					<div ng-if="pagedata.list.length<1" class="content-empty" style="margin-top:0.5rem">
						  <div class="icon ">
							<i class="icon icon-information"></i>
						  </div>
						  <div class="content">暂时没有可购买的购物卡~</div>
					  </div>
				</div>
		</div>
		<div class="fui-cell-group fui-cell-click mod-group">
				<a class="fui-cell external" href="javascript:;">
								<div class="fui-cell-icon"><i class="icon icon-shengriliwu"></i></div>
								<div class="fui-cell-text">活动赠送</div>
				</a>
				<div class="fui-icon-group col-3 selecter" style="padding:0 0.5rem">
					<a ng-repeat="item in pagedata.listgame" class="fui-icon-col external" href="javascript:;" ng-click="post({id:item.id},'jy_weishop/member.getcard/getcard/')">
						<div style="padding:0.2rem;margin:0 0.2rem;border:1px solid #18bc9c;border-radius:0.2rem">
							<div ng-show="item.hot==1" class="badge" style="top:-4px;left:77%">hot</div>
							<div class="text bold" style="padding-bottom:0;font-size:0.8rem">{{item.money}}元</div>
							<div class="subtitle">限时免费领取</div>
						</div>
					</a>
					<div ng-if="pagedata.listgame.length<1" class="content-empty" style="margin-top:0.5rem">
						  <div class="icon ">
							<i class="icon icon-information"></i>
						  </div>
						  <div class="content">暂时没有可直接领的购物卡~</div>
						  <a class="btn btn-default-o external" style="display: block;border-radius:1rem;margin:0.5rem 2rem" href="javascript:;" ng-click="access_json('jy_weishop/index/')">
							也许参与购买某些商品，会赠送购物卡~
						  </a>
					  </div>
				</div>
		</div>
</div>
<script>
scope.pagedata.buy=function(id){
	scope.post_json('jy_weishop/member.getcard/buy/',{'id':id},function(pay_id){
		console.log('pay_id');console.log(pay_id);
		require(['tool'],function(tool){
			tool.pay(pay_id,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('兑换成功！','','jy_weishop/member.mycard/');
				}else{
					scope.message('兑换失败！'+res.message,'','goback');
				}
			});
		});
	});
}
</script>